<template>
  <div class="cargo">
        <el-form :inline="true" :model="form">
      <el-form-item label="仓库名称" :label-width="formLabelWidth">
        <el-input v-model="listQuery.repoName" autocomplete="off"></el-input>
      </el-form-item>
       <el-form-item label="商品名称" :label-width="formLabelWidth">
        <el-input v-model="listQuery.goodsName" autocomplete="off"></el-input>
      </el-form-item>
      <div></div>
      <el-button type="success" icon="el-icon-zoom-in" @click="getStockList()"
        >查询</el-button
      >
    </el-form>
 <el-table
      @current-change="handleSelectionChange"
      highlight-current-row
      :data="stockList"
      border
      style="width:905px; margin: 20px auto"
    >
      <el-table-column
        prop="repoName"
        label="仓库名"
        width="300"
      ></el-table-column>
      <el-table-column
        prop="goodsName"
        label="商品名称"
        width="300"
      ></el-table-column>
 <el-table-column
        prop="count"
        label="商品数量"
        width="300"
      ></el-table-column>
      <!-- <el-table-column fixed="right" label="操作" width="200">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="danger"
            @click="removeBigOrders(scope.$index, scope.row)"
            >删除</el-button
          >
          <el-button
            size="mini"
            type="warning"
            @click="PutBigOrders(scope.$index)"
            >修改</el-button
          >
        </template>
      </el-table-column> -->
    </el-table>
    <div class="block">
      <el-pagination
        @size-change="handleSizeChange"
        :hide-on-single-page="true"
        @current-change="handleCurrentChange"
        :current-page="listQuery.pageNo"
        :page-sizes="[10, 50, 100]"
        :page-size="listQuery.pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      ></el-pagination>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      stockList: [],
            checkStockList: {
        id: "",
      },
      stockTextList:[],
      stockText:false,
      total: "",
      listQuery: {
        pageSize: 10,
        pageNo: 1,
        repoName:"",
        goodsName:""
      },
    };
  },
  created(){
    this.getStockList()
  },
  methods: {
    getStockList() {
      let token = window.localStorage.getItem("token");
      this.$axios({
        method: "get",
        url: this.GLOBAL.stockList,
        params: this.listQuery,
        headers: { "X-Access-Token": token },
      })
        .then((result) => {
          this.stockList = result.data.result.records;
          this.total = result.data.result.total;
        })
        .catch((err) => {
          console.log(err);
        });
    },

        handleSizeChange(val) {
      this.listQuery.pageSize = val;
      this.getStockList();
    },
    handleCurrentChange(val) {
      this.listQuery.pageNo = val;
      this.getStockList();
    },
        handleSelectionChange(val) {
          console.log(val)
      this.checkStockList.id = val.id;
    },
  },
};
</script>

<style>
</style>